package com.neusoft.elmboot.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.elmboot.po.Business;
import com.neusoft.elmboot.service.BusinessService;

@RestController
@RequestMapping("/BusinessController")
public class BusinessController {

	@Autowired

	private BusinessService businessService;

	@RequestMapping("/listBusinessByOrderTypeId")
	public List<Business> listBusinessByOrderTypeId(Business business) throws Exception {
		return businessService.listBusinessByOrderTypeId(business.getOrderTypeId());
	}

	@RequestMapping("/getBusinessById")
	public Business getBusinessById(Business business) throws Exception {
		return businessService.getBusinessById(business.getBusinessId());
	}

	@RequestMapping("/listBusinessByname")
	public List<Business> listBusinessByname(String bname) throws Exception {
		return businessService.listBusinessByname(bname);
	}
	
	@RequestMapping("/updateBusinessSale")
	public int updateBusinessSale(Business business) throws Exception {
		return businessService.updateBusinessSale(business);
	}
	
	@RequestMapping("/addBusiness")
	public int addBusiness(Business business) throws Exception {
		return businessService.addBusiness(business);//注册商家
	}
	
	@RequestMapping("/listBusinessAddressBybusinessId")
	public List<Business> listBusinessAddressBybusinessId(Business business)throws Exception{
		return businessService.listBusinessAddressBybusinessId(business.getBusinessId());
	}
	
	@RequestMapping("/getbusinessbyIdbyPassword")
	public Business getbusinessbyIdbyPassword(Business business) throws Exception {
	return businessService.getbusinessbyIdbyPassword(business);//通过id和密码获取商家
	}

	@RequestMapping("/updateBusiness")
	public int updateBusiness(Business business) throws Exception {
		return businessService.updateBusiness(business);//修改商家信息
	}

	@RequestMapping("/updateBusinessPassword")
	public int updateBusinessPassword(Business business) throws Exception {
		return businessService.updateBusinessPassword(business);//修改商家密码
	}
}